package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	MysqlConfig
	RedisConfig
}

type MysqlConfig struct {
	Host     string
	Post     int
	User     string
	Password string
	DataBase string
}

type RedisConfig struct {
	Addr     string
	Password string
	DB       int
}

var AppConf AppConfig

func Init() {
	viper.SetConfigFile("../appconfig/dev.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&AppConf)

	fmt.Println("动态配置文件:", &AppConf)
}
